//
//  StatusCellBottomView.swift
//  Weibo
//
//  Created by 孙成宇 on 15/12/1.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {
   

@objc    private func retweetedBtnDidClick() {

let temp = TempViewController()
        retweetedBtn.navController()?.pushViewController(temp, animated: true)

    }





    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
    //
    
    private func setUI() {
    
    self.backgroundColor = UIColor(white: 0.98, alpha: 1)
        addSubview(retweetedBtn)
        addSubview(composeBtn)
        addSubview(likeBtn)
    //设置布局
        
        retweetedBtn.snp_makeConstraints { (make) -> Void in
            make.top.left.bottom.equalTo(self)
            
        }
        composeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetedBtn.snp_width)
            
        }
        likeBtn.snp_makeConstraints { (make) -> Void in
          make.left.equalTo(composeBtn.snp_right)
          
            make.right.equalTo(self.snp_right)
            make.width.equalTo(composeBtn.snp_width)
            make.top.bottom.equalTo(self)
            
        }
    
    
        let setView1 = setView()
         addSubview(setView1)
        
        
        let setView2 = setView()
        addSubview(setView2)

        let w = 0.5
       
        let scale = 0.4
        setView1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.width.equalTo(w)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
        }
        
        setView2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.width.equalTo(w)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
        }

//添加点击事件
retweetedBtn.addTarget(self, action: "retweetedBtnDidClick", forControlEvents: .TouchUpInside)


        
    }
    
    
    
    
    private func setView() -> UIView {
    
    
    let v = UIView()
        v.backgroundColor = UIColor.darkGrayColor()
        return v
    
    }
    
    
    //懒加载视图
     private lazy var retweetedBtn: UIButton = UIButton(title: "转发", backImage: nil, color: UIColor.darkGrayColor(), fontSize: 10, isNeedHighlighted: false, imageName: "timeline_icon_retweet")
    
    
    private lazy  var composeBtn: UIButton = UIButton(title: "评论", backImage: nil, color: UIColor.darkGrayColor(), fontSize: 10, isNeedHighlighted: false, imageName: "timeline_icon_comment")
    
    private lazy var likeBtn: UIButton = UIButton(title: "赞", backImage: nil, color: UIColor.darkGrayColor(), fontSize: 10, isNeedHighlighted: false, imageName: "timeline_icon_unlike")
    
    
    
}
